package com.xinchuang.mapper.train;

import com.xinchuang.entity.train.TrainImg;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.mapstruct.Mapper;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zx
 * @since 2023-08-31
 */
public interface TrainImgMapper extends BaseMapper<TrainImg> {

    @Select("SELECT MAX(sort) FROM train_img")
    Integer selectSortMax();

    @Update("UPDATE train_img SET sort = sort - 1 WHERE sort > #{sort}")
    int updateSort(int sort);

}
